package com.sxf.auth.enums;

import com.sxf.common.exceptions.BusinessException;

/**
 * @author Author
 * @version 1.0
 * @description
 * @date 2024/3/6 10:17:53
 */
public enum UserTypeEnum {
    PLATFORM("OP","运营端"),
    CUSTOMER("CM","客户端"),
    COORDINATE("CO","临床管理端"),
    SUBJECTS("SUB","受试者"),
    ;

    private final String code;
    private final String message;

    public static final String DESC = "登陆客户端 OP:运营端,CM：客户端；CO:临床管理端；SUB：受试者";

    UserTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static UserTypeEnum getEnumByCode(String code) {
        for (UserTypeEnum enums :UserTypeEnum.values()) {
            if (enums.getCode().equals(code)) {
                return enums;
            }
        }
        throw new BusinessException("用户类型不存在");
    }

}
